<?php

/**
 * user actions.
 *
 * @package    iEasy
 * @subpackage user
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class userActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {
      $content=$request->getParameter("content");
          if(!empty($content))
          {
              $Ids=explode(" ",$content);
              for($i=0;$i<count($Ids);$i++)
              {
                  if(!empty($Ids[$i]))
                  {
                      $duser=@Doctrine_Core::getTable('Users')->find($Ids[$i]);
                      $duser->setIsActivateB(0);
                      $duser->save();
                  }
              }
          }
     $this->recordCount=$request->getParameter('recordCount');
     $this->currentPage=$request->getParameter('currentPage');
     if(null==$this->recordCount||""==$this->recordCount)
         $this->recordCount=20;
     if(null==$this->currentPage||""==$this->currentPage)
         $this->currentPage=1;
     $query = Doctrine_Query::create()->from("Users u")
     ->Where('is_activate_b=1')
     //->andWhere('sub_catalog_id='.$this->subCatalogId)
            ->orderBy('u.create_time desc,u.user_id desc');
     $this->pages = new sfDoctrinePager('Users',$this->recordCount);//$this->currentPage
     $this->pages->setQuery($query);  //$q   数据库查询语句
     $this->pages->setPage($this->currentPage);//
     $this->pages->init();
  }
  public function executeEdit(sfWebRequest $request)
  {
      if($request->getParameter('userid')>0)
      {
          $this->getUser()->setAttribute('userId', $request->getParameter('userid'));
      }
  }

  public function executeAdd(sfWebRequest $request)
  {
 
  }
}
